/*
 * User: rant
 * Date: Aug 15, 2007
 *
 *
 */
package laMalinche.testingPlayGround.swingTest;

import laMalinche.rete.rule.ProductionRule;
import laMalinche.propertyChangeAdapters.rules.BasicConstraintRule;
import laMalinche.propertyChangeAdapters.rules.BasicDisjunctionCondition;
import laMalinche.testingPlayGround.testModel.PersonVo;

import java.util.*;

/**
 *
 */
public class SwingTestRules {

		public static Set<ProductionRule> createteProductionRules(final PersonVo person) {
		Set<ProductionRule> result = new HashSet<ProductionRule>();
		final BasicConstraintRule rule = new BasicConstraintRule("r1");
		rule.addCondition(new BasicDisjunctionCondition() {
            public boolean isComplied() {
				return person.getAge() == 1;
			}
		});

		final BasicConstraintRule rule2 = new BasicConstraintRule("r2");
		rule2.addCondition(new BasicDisjunctionCondition() {
            public boolean isComplied() {
				return person.getAge() == 13;
			}
		});
		final BasicConstraintRule rule3 = new BasicConstraintRule("r3");
		rule3.addCondition(new BasicDisjunctionCondition() {
            public boolean isComplied() {
				return person.getFather().getAge() == 3;
			}
		});
		rule3.addCondition(new BasicDisjunctionCondition() {
            public boolean isComplied() {
				return person.getMother().getAge() == 2;
			}
		});
		result.add(rule3);
		result.add(rule2);
		result.add(rule);
		return result;
	}

}